package com.fwj.auth.handle;

import com.fwj.core.common.execption.CommonException;
import com.fwj.core.common.model.ResponseDTO;
import com.fwj.core.common.model.ResponseEnum;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: fwj
 * @Data: 2022/4/10 11:42
 * @Version 1.0
 * @Description:
 */

@RestControllerAdvice
@Component
public class AuthExceptionHandler {

    @ExceptionHandler(UsernameNotFoundException.class)
    public ResponseDTO usernameNotFoundException(UsernameNotFoundException exception){
        return new ResponseDTO().fail(ResponseEnum.USER_NO_LOGIN);
    }

}
